package com.gxa.controller.investment;

import com.gxa.common.utils.Result;
import com.gxa.entity.investment.BusinessType;
import com.gxa.entity.investment.BusinessTypeChild;
import com.gxa.entity.investment.StatisticalIndices;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 招商配置——统计指标 前端控制器
 * </p>
 *
 * @author yjl
 * @since 2022-10-15 10:58:56
 */
//@Api(tags = "项目授权")
@RestController
@RequestMapping("/statistical/indices")
public class StatisticalIndicesController {
//    private List<StatisticalIndices> list01;
//    public StatisticalIndicesController(){
//        this.init();
//    }
//    void init(){
//        this.list01 = new ArrayList<>();
//        StatisticalIndices statisticalIndices = new StatisticalIndices();
//        list01.add(businessType);
//        list01.add(businessType2);
//
//
//
//    }
    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("父列表接口")
    @GetMapping("/list")
    public Result seletAll(){
        return Result.success("父类查询OK");
    };

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("子列表接口")
    @GetMapping("/list/child")
    public Result seletAllChild(){
        return Result.success("子类查询OK");
    };

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("父增加接口")
    @PostMapping("/add")
    public Result add(@RequestBody BusinessType businessType){

        return Result.success("add 父类 success");
    }

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("子增加接口")
    @PostMapping("/add/child")
    public Result addChild(@RequestBody BusinessTypeChild businessTypeChild){

        return Result.success("add 子类 success");
    }

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("父删除接口")
    @DeleteMapping("/delete/{id}}")
    public Result delete(@PathVariable Integer id){

        return Result.success("delete success");
    }

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("子删除接口")
    @DeleteMapping("/delete/child/{id}}")
    public Result deleteChild(@PathVariable Integer id){

        return Result.success("delete 子 success");
    }

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("父编辑接口")
    @PutMapping("/update")
    public Result update(@RequestBody BusinessType businessType){

        return Result.success("update 父 success");
    }

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("子编辑接口")
    @PutMapping("/update/child")
    public Result updateChild(@RequestBody BusinessTypeChild businessTypeChild){

        return Result.success("update 子 success");
    }
}
